<template>
  <div class="login-body">
    <h1>后台系统登录</h1>
    <div class="login-item">
      <input type="text" placeholder="请输入账号" v-model.trim="username"><br>
      <input type="password" placeholder="请输入密码" v-model.trim="password"><br>
      <button @click="login">登&nbsp;&nbsp;&nbsp;录</button>
      <p>账号：admin &nbsp;&nbsp;&nbsp;&nbsp;密码：123456</p>
    </div>
  </div>
</template>

<script>
export default {
    name: 'login',
    data() {
      return {
        username: '',
        password: ''
      }
    },
    methods: {
      login() {
        if(this.username == 'admin' && this.password == '123456'){
          // console.log(123)
          localStorage.setItem('token','Bearer xxxx')
          this.$router.push('/home')
        }else {
          this.username = ''
          this.password = ''
          // console.log(456)
          alert('请输入正确账号密码！')
        }
      }
    }
}
</script>

<style scoped>
  .login-body {
    /* width: 100vh; */
    /* position: relative; */
    height: 100vh;
    background-color: rgb(58, 75, 124);
    overflow: hidden;
  }
  h1 {
    margin-top: 190px;
    color: #fff;
    text-align: center;
    margin-bottom: 60px;
    font-size: 50px;
  }
  .login-item {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-top: 50px;
    /* background-color: rgb(54, 69, 116); */
    /* background-color: #fff; */
    width: 700px;
    /* height: 500px; */
    margin: 0 auto;
    border-radius: 8px;
    box-sizing: border-box;
    /* padding: 50px; */
  }
  .login-item input {
    border: none;
    width: 500px;
    height: 45px;
    border-radius: 8px;
    font-size: 18px;
    color: #ccc;
    padding-left: 8px;
    background-color: rgb(38, 46, 71);
  }
  .login-item button {
    width: 500px;
    height: 50px;
    border: none;
    color: #fff;
    font-size: 20px;
    background-color: lightskyblue;
    border-radius: 8px;
    /* margin-top: 50px; */
  }
  input::placeholder {
    padding-left: 8px;
    color: #ccc;
    font-size: 18px;
  }
  .login-item p {
    color: #ccc;
    margin-top: 20px;
    font-size: 18px;
  }
</style>